#include <algorithm>
#include <cstdio>
const int N = 100010;
int n, m, tot, rt;
int a[N];

struct Node {
	int fa, size, flag, cnt, val, son[2];
} s[N];

inline bool id(int x) {
	return s[s[x].fa].son[1] == x;
}

inline void update(int x) {
	if (x) {
		s[x].size = s[x].cnt;
		if (s[x].son[0]) s[x].size += s[s[x].son[0]].size;
		if (s[x].son[1]) s[x].size += s[s[x].son[1]].size;
	}
}

inline void connect(int x, int fa, bool opt) {
	if (x) s[x].fa = fa;
	if (fa) s[fa].son[opt] = x;
}

inline void rotate(int x) {
	int fa = s[x].fa, grfa = s[fa].fa;
	bool xtofa = id(x), fatogrfa = id(fa);
	connect(s[x].son[1^xtofa], fa, xtofa);
	connect(fa, x, 1^xtofa);
	connect(x, grfa, fatogrfa);
	update(fa);
	update(x);
}

inline void splay(int x, int y) {
	int cur = s[x].fa;
	while (cur != y) {
		if (s[cur].fa != y)
			rotate(id(x) == id(cur) ? cur : x);
		rotate(x);
		cur = s[x].fa;
	}
	if (y == 0) rt = x;
}

inline void pushdown(int x) {
	if (x && s[x].flag) {
		s[s[x].son[0]].flag ^= 1;
		s[s[x].son[1]].flag ^= 1;
		std::swap(s[x].son[0], s[x].son[1]);
		s[x].flag = 0;
	}
}

int build(int l, int r, int fa) {
	if (l > r) return 0;
	int mid = (l + r) >> 1;
	int cur = ++tot;
	s[cur].fa = fa;
	++s[cur].cnt;
	s[cur].val = a[mid];
	s[cur].son[0] = build(l, mid - 1, cur);
	s[cur].son[1] = build(mid + 1, r, cur);
	update(cur);
	return cur;
}

inline int find(int x) {
	int cur = rt;
	while (true) {
		pushdown(cur);
		if (x <= s[s[cur].son[0]].size)
			cur = s[cur].son[0];
		else {
			x -= s[s[cur].son[0]].size + 1;
			if (!x) return cur;
			cur = s[cur].son[1];
		}
	}
}

inline void reverse(int x, int y) {
	int l = x - 1, r = y + 1;
	l = find(l), r = find(r);
	splay(l, 0);
	splay(r, l);
	s[s[s[rt].son[1]].son[0]].flag ^= 1;
}

inline void forea(int cur) {
	pushdown(cur);
	if (s[cur].son[0])
		forea(s[cur].son[0]);
	if (s[cur].val != 0x7fffffff && s[cur].val != -0x7fffffff)
		printf("%d ", s[cur].val);
	if (s[cur].son[1])
		forea(s[cur].son[1]);
}
int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
	freopen("ArrayReverse(Splay).in", "r", stdin);
	freopen("ArrayReverse(Splay).out", "w", stdout);
#endif
#endif

	scanf("%d%d", &n, &m);
	a[1] = 0x7fffffff, a[n + 2] = -0x7fffffff;
	for (int i = 1; i <= n; ++i) {
		a[i + 1] = i;
	}
	rt = build(1, n + 2, 0);
	int a, b;
	for (int i = 0; i < m; ++i) {
		scanf("%d%d", &a, &b);
		reverse(a + 1, b + 1);
	}
	forea(rt);
	return 0;
}